<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button onclick="handleClick()">点击我</button>
</body>
<script>
    function fun1() {
        console.log("我要吃饭");
    }

    function fun2() {
        console.log("我要喝酒");
    }

    let index = 0;


    function handleClick() {
        function doWhat(fun) {
            console.log("我现在学习完了！");
            console.log("我现在想做其它事情：")
            fun();
        }

        let fun;
        if (index ++ % 2 == 0) {
            fun = fun1;
        } else {
            fun = fun2;
        }

        doWhat(fun);
    }
</script>
</html>